#pragma once


#include "KnowlTypeTree.h"

class IDictCateCallback
{
public:
	virtual void OnClickDict(DWORD nIndex, int nID) = 0;
};



class CDictCategoryTree
	: public CKnowlTypeTree
{
public:
	CDictCategoryTree(){}
	BOOL Load()
	{
		
		return m_CateManager.Load(this,L"DICT");
	}
	void SetDictCallback(IDictCateCallback* callback)
	{
		m_DictCallback = callback;
	}
	virtual LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
	{
		POINT pt = {LOWORD(lParam), HIWORD(lParam)}; 
		HTREEITEM hTreeItem = HitTest(pt, &m_uClickFlags);
		if (hTreeItem != NULL)
		{
			int nID = (int)GetItemData(hTreeItem);
			if(NULL != m_DictCallback)
				m_DictCallback->OnClickDict(0,nID);
		}
		return __super::OnLButtonDown(uMsg,wParam,lParam,bHandled);

	}
	
protected:
	IDictCateCallback*	m_DictCallback;
	CCategoryManager		m_CateManager;
};